<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<title>投保预览</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp"%>
<link rel="stylesheet" href="css/jquery.datetimepicker.css" type="text/css" />
<link rel="stylesheet" href="css/poshytip/tip-yellowsimple/tip-yellowsimple.css" type="text/css" />
<script type="text/javascript" src="js/jquery.datetimepicker.js"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/poshytip/jquery.poshytip.js"></script>
<style type="text/css">
.table_my th{  color:#343233; width:11%; text-align:center; line-height:26px; border-bottom:1px #bbcddb solid;font-weight: 700;}

</style>
<script type="text/javascript">
$(function(){
    $.openLoading_jhk();
    var cardTotPremamt = '${prodInfo.cardInfo.totPremamt}';
    cardTotPremamt=fmoney(parseFloat(cardTotPremamt));
    $("#cardTotPremamt").html(cardTotPremamt);
    init();
    if($("#riskMain").val()=='2'){
    	$("[name='drivingInfo']").show();
    }else{
    	$("[name='drivingInfo']").hide();
    }
    queryAppForm();
    queryRiskList();
    var warnInfo = $("#warnInfo").val();
    if(warnInfo!=null&&""!=warnInfo){
    	$("#checkInfo").html(warnInfo);
    	$("#checkI1").show();
    	$("#checkI2").show();
    }
    $.closeLoading();
});
function queryAppForm(){
    var stagNo = $("#stagNo").val();
    $.ajax({
        url : "activatedCard/queryAppForm",
        type : 'POST',
        async : true,
        dataType:'json',
        data:{"stagNoJm":stagNo},
        success : function(result){
            if("fail"==result.result){
                $.message("error", "系统错误,请联系管理员");
            }else if("success"==result.result){
                var data = result.data;
                if("Y"==data.realSignFlag){
                    $("#realSignFlag").html("是");
                }else{
                    $("#realSignFlag").html("否");
                }
                $("#trip").html(data.trip);
                $("#unirPp").html(data.unirPp);
                $("#dayCount").html(data.dayCount);
                $("#effDate").html(data.stringEffDate);
                $("#termDate").html(data.stringTermDate);
                $("#insuredCount").html(data.insuredCount);

                var totPremamt= data.totPremamt;
                var insAmount= data.insAmount;
                var premNotax= data.premNotax;
                var premVat= data.premVat;
                totPremamt = fmoney(parseFloat(totPremamt));
                premNotax = fmoney(parseFloat(premNotax));
                premVat = fmoney(parseFloat(premVat));
                insAmount = fmoney(parseFloat(insAmount));
                $("#totPremamt").html(totPremamt);
                $("#premNotax").html(premNotax);
                $("#premVat").html(premVat);
                $("#insAmount").html(insAmount);
            }else{
                $.message("error", result.message);
            }
        }
    }); 
}

function queryRiskList(){
    var planNo = $("#planNo").val();
    $.ajax({
        url : "activatedCard/queryRiskList",
        type : 'POST',
        async : true,
        dataType:'json',
        data:{"planNo":planNo},
        success : function(result){
            if("fail"==result.result){
                $.message("error", "系统错误,请联系管理员");
            }else if("success"==result.result){
                var data = result.data;
                $("#riskList").empty();
                var trHtml;
                for(var i = 0; i < data.length; i++){
                    trHtml="<tr><td style='text-align:center'>"+data[i].RISK_NAME+"</td>"
                       +"<td style='text-align:center'>"+data[i].COV_NAME+"</td>"
                       +"<td style='text-align:center'>"+data[i].COV_AMT+"</td></tr>"
                    $("#riskList").append(trHtml);
                }
                if(data[0].SPECIAL_ARRAN!=null&&data[0].SPECIAL_ARRAN!=''){
                	$("#specialArran").html(data[0].SPECIAL_ARRAN);
                }else{
                	$("#specialArran").html('无');
                }
                if(data[0].NOTICE!=null&&data[0].NOTICE!=''){
                    $("#notice").html(data[0].NOTICE);
                }else{
                    $("#notice").html('无');
                }
                
            }else{
                $.message("error", result.message);
            }
        }
    }); 
}
function init() {
	var pricelessType = $("#pricelessType").val();
	stepConObj.curStepIndex=2;//当前已完成索引位置
	if(pricelessType=="1"){
	    stepConObj.stepContentFlag="2";//1非见费和2见费标识
	}else{
	    stepConObj.stepContentFlag="1";//1非见费和2见费标识
	}
    stepControl(stepConObj);
}
function insureSubmit(stagNo,cardNo){
    var totPremamt = $("#totPremamt").html().replace(/,/g, "");
    var cardTotPremamt=$("#cardTotPremamt").html().replace(/,/g, "");
    if(totPremamt-cardTotPremamt!=0){
        $.message("error","卡单保费和保单保费不一致，不能投保！");
    }else{
        $.openLoading_jhk();
        window.location.href="<%=path%>/activatedCard/group/confirmGroup?stagNo="+encodeURIComponent(stagNo)+"&cardNo="+cardNo;
    }
}
function goBack(stagNo){
	$.openLoading_jhk();
    window.location.href="<%=path%>/activatedCard/group/add?stagNo="+encodeURIComponent(stagNo);
}
</script>
</head>
<body>
    <div class="current">
        <table class="current_table_1">
            <tbody>
                <tr class="f2">
                    <td><img src="./images/current_1.jpg"></td>
                    <td class="current_table_1_td"><img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                        <span style="color: #136bab;">激活卡管理 <span
                            style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>激活卡激活
                            <span
                            style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>投保预览
                    </span></td>
                    <td><img src="./images/current_3.jpg"></td>
                </tr>
            </tbody>
        </table>
    </div>
    <form action="" method="post" id="mainForm">
        <div class="setp"><jsp:include page="../include/stepScroll.jsp"/></div>
        <input type="hidden" name="warnInfo" id="warnInfo" value="${warnInfo}" />
        <input type="hidden" name="stagNo" id="stagNo" value="${stagNo}" />
        <input type="hidden" name="appNo" id="appNo" value="${appNo}" />
        <input type="hidden" name="riskMain" id="riskMain" value="${prodInfo.riskMainType}" />
        <input type="hidden" name="planNo" id="planNo" value="${prodInfo.planNo}" />
        <input type="hidden" name="planName" id="planName" value="${prodInfo.planName}" />
        <input type="hidden" name="pricelessType" id="pricelessType" value="${prodInfo.cardInfo.pricelessType}" />
      <div>
        <table class="table_05">
            <tbody>
				 <tr id="checkI1" style="display: none;">
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">黑名单信息</td>
                </tr>
				<tr id="checkI2" style="display: none;">
					<td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: center; background:yellow;color:black; line-height: 17px;" id="checkInfo"></td>
				</tr>
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">卡单信息</td>
                </tr>
                <tr>
                    <th width="25%">卡定义名称：</th>
                    <td width="28%">
                        ${prodInfo.cardInfo.name}
                    </td>
                    <th width="22%">卡号：</th>
                    <td width="20%">
                        ${prodInfo.cardInfo.cardNo}
                    </td>
                </tr>
                <tr>
                    <th>保费：</th>
                    <td colspan='3'>
                        <span id='cardTotPremamt'></span>元
                    </td>
                </tr>
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">基本信息
                    </td>
                </tr>
                <tr>
                    <th>投保方案：</th>
                    <td>
                        ${prodInfo.planName}
                    </td>
                    <th>即时起保：</th>
                    <td>
                        <span id='realSignFlag'></span>
                    </td>
                </tr>
                <tr style="display:none;" id="tripId">
                    <th>行程/航班：</th>
                    <td>
                        <span id='trip'></span>
                    </td>
                </tr>
                <tr>
                    <th>投保份数：</th>
                    <td id="unirPpFlag">
                        <span id='unirPp'></span>
                    </td>
                    <th id="globalDMY">保险天数：</th>
                    <td>
                        <span id='dayCount'></span>
                    </td>
                </tr>
                <tr>
                    <th>起保日期：</th>
                    <td>
                        <span id='effDate'></span>
                    </td>
                    <th>被保人数：</th>
                    <td>
                        <span id='insuredCount'></span>
                    </td>
                </tr>
                <tr>
                    <th>终保日期：</th>
                    <td>
                        <span id='termDate'></span>
                    </td>
                   <th>总保额：</th>
                   <td>
                       <span id='insAmount' style="color:red;font-size:20px;"></span>元
                   </td>
                </tr>
               <tr>
                   <th>含税总保费：</th>
                   <td>
                       <span id='totPremamt' style="color:red;font-size:20px;"></span>元
                   </td>
                   <th>不含税总保费：</th>
                   <td>
                       <span id='premNotax'></span>元
                   </td>
                </tr>
                <tr>
                   <th>增值税总额：</th>
                   <td colspan='3'>
                       <span id='premVat'></span>元
                   </td>
                </tr>
                <tr name="drivingInfo">
                    <th>车牌号：</th>
                   <td>
                       ${extend.plateNum}
                   </td>
                    <th>车架号：</th>
                   <td>
                       ${extend.chassisNum}
                   </td>
                </tr>
                <tr name="drivingInfo">
                    <th>投保座位数：</th>
                   <td>
                       ${extend.seatNum}
                   </td>
                    <th>车辆性质：</th>
                   <td>
                       <c:forEach var="n" items="${mainVehicleNatureList}">
                            <c:if test="${extend.mainVehicleNature eq n.code}">${n.codeName}</c:if>
                         </c:forEach>
                   </td>
                </tr>
            </tbody>
        </table>
      </div>
        <div id="bbrDiv">
           <table class="table_my table_05">
             <thead>
                <tr>
                   <td colspan="3"
                     style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">条款责任信息
                   </td>
               </tr>
               <tr>
                <th width="40%">条款名称</th>
                <th width="30%">责任名称</th>
                <th width="30%">保额</th>
               </tr>
             </thead>
             <tbody id="riskList">
             </tbody>
           </table>
           </div>
           <div id="bbrDiv">
           <table class="table_05">
               <tr>
                   <td colspan="4"
                     style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">特别约定
                   </td>
               </tr>
               <tr>
                   <td colspan='4'><span id='specialArran'></span></td>
               </tr>
               <tr>
                   <td colspan="4"
                     style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">温馨提示
                   </td>
               </tr>
               <tr>
                   <td colspan='4'><span id='notice'></span></td>
               </tr>
           </table>
           </div>
        <br>
        <br>
        
        <div align="center">
           <input class="input_button_2" name="" type="button" onclick="goBack('${stagNo}')" value="返  回">&nbsp;&nbsp;
           <input class="input_button_2" name="" type="button" onclick="insureSubmit('${stagNo}','${cardInfo.cardNo}')" value="投保">
        </div>
        <br>
    </form>
</body>
</html>